home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_bubblegen.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  113 lines

  1. # Jones 3D Cog Script
  2. #
  3. # GEN_BubbleGen.cog
  4. #
  5. # Attach to a ghost object.
  6. # single=1: single bubble stream
  7. # single=0: multiple, wide patern (x=2.5m, y=0.5m)
  8. # bub_Life: amount of time before bubbles completely fade out.
  9. #
  10. # [TRM]
  11. #
  12. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  13. # ========================================================================================
  14.  
  15. symbols
  16.  
  17.     message     sighted
  18.     message     timer
  19.     
  20.     thing       origin          # Where the bubbles are coming from
  21.     thing       bubble          local
  22.     thing       player          local
  23.     
  24.     template    bubble0=+bubbles      local
  25.     template    bubble1=+bubbles      local
  26.     template    bubble2=+bubbles      local
  27.     
  28.     vector      startBubble     local
  29.     vector      finBubble       local
  30.     vector      bubbleVel       local
  31.     vector      vecPos          local
  32.     
  33.     int         single=0        # 1 = single bubble stream, 0 = multiple random stream
  34.     int         i=0             local
  35.     int            blurps=3        local
  36.     
  37.     flex        bub_Life=2.0
  38.     
  39. end
  40.  
  41. # ========================================================================================
  42.  
  43. code
  44.  
  45. sighted:
  46.  
  47.     player = GetLocalPlayerThing();
  48.     Sleep(0.01);
  49.     
  50.     Print("sighted");
  51.     
  52.     if(HasLOS(player, origin))
  53.     {
  54.         SetTimer(1.0);
  55.     }
  56.     
  57.     return;
  58.  
  59. # ========================================================================================
  60.  
  61. timer:
  62.  
  63.     if(single == 1)
  64.     {
  65.         for(i=0; i<blurps; i=i+1)                                                                        
  66.         {                                                                                                    
  67.             bubble = CreateThing(bubble0[RandBetween(0,2)], origin);
  68.             bubbleVel = VectorSet(0,0,rand()+0.25);
  69.             SetThingVel(bubble, VectorScale(bubblevel, 0.2));
  70.             
  71.             startBubble = VectorSet(0.01, 0.01, 1.0);
  72.             finBubble = VectorSet(0.05, 0.05, 0.0);
  73.             AnimateSpriteSize(bubble, startBubble, finBubble, bub_Life);
  74.         }
  75.         
  76.         i = 0;
  77.     }
  78.         
  79.     if(single == 0)
  80.     {
  81.         for(i=0; i<blurps; i=i+1)                                                                        
  82.         {                                                                                                    
  83.             vecPos = VectorSet(rand()*0.25, rand()*0.05, 0);
  84.             bubble = CreateThingAtPos(bubble0[RandBetween(0,2)], GetThingSector(origin), VectorAdd(GetThingPos(origin), vecPos), '0 0 0');
  85.             bubbleVel = VectorSet(0,0,rand()+0.25);
  86.             SetThingVel(bubble, VectorScale(bubblevel, 0.2));
  87.             
  88.             startBubble = VectorSet(0.01, 0.01, 1.0);
  89.             finBubble = VectorSet(0.05, 0.05, 0.0);
  90.             AnimateSpriteSize(bubble, startBubble, finBubble, bub_Life);
  91.         }
  92.         
  93.         i = 0;
  94.     }
  95.         
  96.     if(HasLOS(player, origin))
  97.     {
  98.         SetTimer(1.0);
  99.     }
  100.     
  101.     if(!HasLOS(player, origin))
  102.     {
  103.         Print("no LOS");
  104.         ClearThingFlags(origin, 0x100000);  # mark thing as unseen
  105.     }
  106.     
  107.     return;   
  108.     
  109. # ========================================================================================
  110.  
  111. end
  112.  
  113.